package com.rmv.ums.response;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.dom4j.Element;

public class ErrorResponse extends AbstractResponse {

	private int status;

	public boolean configure(Element element) {
		if (super.configure(element)) {
			// class
			String strStatus = element.attributeValue("status");
			this.status = Integer.parseInt(strStatus);

			return true;
		} else {
			return false;
		}
	}

	public void process(HttpServletRequest request, HttpServletResponse response) throws IOException {
		response.sendError(status, value);
	}

	public String toString() {
		return "[response:id=" + id + ",status=" + status + ",value=" + value + "]";
	}

}
